



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<title>jb-aptech毕业设计项目</TITLE>
<meta name="renderer" content="ie-comp">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="../../css/style.css" rel="stylesheet" type="text/css">
		<script src="../../script/common.js"></script>
		<script src="../../script/validate.js"></script>
		<script src="../../js/vue.js"></script>
		<script src="../../js/jquery/jquery-1.5.2.min.js"></script>
	</head>
		<script type="text/javascript">

			function myAdd(){
				if(document.getElementById("rightCode").value=""){
					document.getElementById("codeSpan").innerHTML="不能为空";
					return;
				}
				if(document.getElementById("rightText").value=""){
					document.getElementById("textSpan").innetHTML="不能为空";
					return;
				}
				if(document.getElementById("rightUrl").value=""){
					document.getElementById("urlSpan").innerHTML="不能为空";
					return;
				}

				document.sysRightForm.submit();

			}
		</script>
	<body>
	<div id="app">
		<div class="page_title">
			权限管理 > 权限管理 > 添加权限
		</div>
		<form name="sysRightForm" method="post" action="/CRM/sysRight.do">
			<input type="hidden" name="method" value="addSysRight">
			<div class="button_bar">
				<button class="common_button" onclick="help('');">
					帮助
				</button>
				<a class="common_button" href="detail.html">
					返回
				</a>
				<button class="common_button" @click="add" type="button">
					保存
				</button>
			</div>
			<table class="query_form_table">
				<tr>
					<th>
						编号
					</th>
					<td>
						<input type="text" name="sysRight.rightCode"  id="bh">
						<span class="red_star" id="codeSpan">*</span>
					</td>
					<th>
						权限类型
					</th>
					<td>
						<select name="sysRight.rightType" id="lx">
						  <option value="Folder">父节点
						  <option value="Document">子节点
						  </select>
					</td>
					<th>
						权限文本
					</th>
					<td>
						<input type="text" name="sysRight.rightText"  id="wb">
						<span class="red_star" id="textSpan">*</span>
					</td>

				</tr>
				<tr>

					<th>
						权限URL
					</th>
					<td>
						<input type="text" name="sysRight.rightUrl" value=" " id="url">
						<span class="red_star" id="urlSpan">*</span>
					</td>
					<th>权限描述</th>
					<td>
						<textarea name="sysRight.rightTip" id="ms"></textarea>
					</td>
				</tr>
			</table>
			<script>
				build_validate("sysRight.rightCode","编号不能为空","Limit","1","50");
				build_validate("sysRight.rightParentCode","父节点不能为�?","Limit","1","50");
				build_validate("sysRight.rightText","权限文本不能为空","Limit","1","50");
			</script>
		</form>
	</div>
	</body>
	<script>
		const  app=new Vue({
			el:"#app",
			data:{
				sum:[],
				sums:{
					right_code:"",
				},
			},methods:{
				load(){
					$.getJSON("/SysMight/queryPage",this.sums,json=>{
						this.pageInfo=json.data.pageInfo;
						this.sum=json.data.pageInfo.list;
					});
				},
				add(){
					let bh = $("#bh").val();
					let lx = $("#lx").val();
					let ms = $("#ms").val();
					let wb = $("#wb").val();
					let url = $("#url").val();
					$.post("/SysMight/save", {"right_code":bh,"right_icon":lx,"right_text":wb,"right_tip":ms,"right_url":url}, json => {
						if (json.message == "OK") {
							alert("保存成功");
							location.href = "list.html";
						} else {
							alert("保存失败");
							location.href = "list.html";
						}
					})
				}
			},mounted(){
				let ser=new URLSearchParams(location.search).get("right_code");
				this.sums.right_code=ser;

				this.load();
			}
		});
	</script>
</html>

